function validate(){
    $("#formEdit")
        .validate(
        {
            rules : {
                'irb.comiteEtica.id': "required",
                'irb.docType.id' : "required",
                'irb.requiredTime' : "required",
                'irb.submPeriodic' : "required",
                'irb.typeDev' : "required",
                'irb.submDev' : "required",
                'reapprovalReq' : "required",
                'irb.frequency' : "required"
            }
        })
}

function changeComites(url){
    $.ajax({
        async: false,
        traditional: true,
        type: "POST",
        url: url,
        success: function(result)
        {
            $("#comite").parent().parent().remove();
            $("#irbId").after(result);
            requiredTimelineCheck();
            $("#irbId").val("");
        }
    });
}

function requiredTimelineCheck(){
    $('.requiredTimeline').each(function(index, select){
        if($(select).val() == 'Other'){
            $(select).parent().parent().next().show();
            $(select).parent().parent().next().next().show();
        }
        else if($(select).val() == 'Not Specified'){
            $(select).parent().parent().next().hide();
            $(select).parent().parent().next().next().show();
        }
        else{
            $(select).parent().parent().next().hide();
            $(select).parent().parent().next().next().hide();
        }
    });
}